package gemini.basic.model;

// default package
// Generated Nov 23, 2010 4:23:01 PM by Hibernate Tools 3.4.0.Beta1

import static javax.persistence.GenerationType.IDENTITY;

import java.util.ArrayList;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Version;

/**
 * Address generated by hbm2java
 */
@Entity
@Table(name = "g_address", catalog = "gemini")
public class Address extends AbstractDomain {

	private static final long serialVersionUID = 1L;

	private Integer id;
	private Integer version;
	private String addressLine1;
	private String addressLine2;
	private String district;
	private String city;
	private String country;
	private List<Event> events = new ArrayList<Event>(0);
	private List<Cart> cartsForBillingAddress = new ArrayList<Cart>(0);
	private List<Cart> cartsForShippingAddress = new ArrayList<Cart>(0);
	private List<Person> persons = new ArrayList<Person>(0);


	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "id", unique = true, nullable = false)
	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@Version
	@Column(name = "version")
	public Integer getVersion() {
		return this.version;
	}

	public void setVersion(Integer version) {
		this.version = version;
	}

	@Column(name = "address_line_1", nullable = false, length = 100)
	public String getAddressLine1() {
		return this.addressLine1;
	}

	public void setAddressLine1(String addressLine1) {
		this.addressLine1 = addressLine1;
	}

	@Column(name = "address_line_2", length = 100)
	public String getAddressLine2() {
		return this.addressLine2;
	}

	public void setAddressLine2(String addressLine2) {
		this.addressLine2 = addressLine2;
	}

	@Column(name = "district", nullable = false, length = 30)
	public String getDistrict() {
		return this.district;
	}

	public void setDistrict(String district) {
		this.district = district;
	}

	@Column(name = "city", nullable = false, length = 30)
	public String getCity() {
		return this.city;
	}

	public void setCity(String city) {
		this.city = city;
	}

	@Column(name = "country", nullable = false, length = 30)
	public String getCountry() {
		return this.country;
	}

	public void setCountry(String country) {
		this.country = country;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "addressByBillingAddress")
	public List<Cart> getCartsForBillingAddress() {
		return this.cartsForBillingAddress;
	}

	public void setCartsForBillingAddress(List<Cart> cartsForBillingAddress) {
		this.cartsForBillingAddress = cartsForBillingAddress;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "addressByShippingAddress")
	public List<Cart> getCartsForShippingAddress() {
		return this.cartsForShippingAddress;
	}

	public void setCartsForShippingAddress(List<Cart> cartsForShippingAddress) {
		this.cartsForShippingAddress = cartsForShippingAddress;
	}
	
	@OneToMany(fetch = FetchType.LAZY, mappedBy = "address")
	public List<Person> getPersons() {
		return this.persons;
	}

	public void setPersons(List<Person> persons) {
		this.persons = persons;
	}
	
	@OneToMany(fetch = FetchType.LAZY, mappedBy = "address")
	public List<Event> getEvents() {
		return this.events;
	}

	public void setEvents(List<Event> events) {
		this.events = events;
	}
}
